const { default: axios } = require("axios");
const jwt = require('jwt-simple');
const SECRET = 'zhuoran'; // 自定义
const {tokenERR}=require('../errType/err.type')

const yanzhenger=async (ctx,next)=>{
  const authorization = ctx.request.headers['authorization'];
  console.log(authorization,22);
  if(authorization){
    const openid = jwt.decode(authorization, SECRET);
    console.log(openid)
    
  }
  ctx.body = {
          code: 200,
          token: "awd",
          msg:"登录成功"
      };
  
}
module.exports = {
  yanzhenger
}
// class Yanzheng {
    
//     async yanzhenzjj(ctx, next) {
//       const authorization = ctx.request.headers['authorization'];
//     //   const openid = jwt.decode(token, SECRET);
//     //   console.log(op)
//     //  // 打印提取的 token 以供调试
//      console.log('Extracted Token:', authorization);
//     //    await next()
//     ctx.body = {
//       code: 200,
//       token: token,
//       msg:"登录成功"
//   };
//     }
// }

// module.exports = new Yanzheng();